use crate::global::MaterialType;
use crate::vector::{Vector2f, Vector3f};
use crate::{global, v3f};

pub struct Object {
    pub material_type: global::MaterialType,
    pub ior: f32,
    pub kd: f32,
    pub ks: f32,
    pub diffuse_color: Vector3f,
    pub specular_exponent: f32,
}

impl Default for Object {
    fn default() -> Self {
        Self {
            material_type: global::MaterialType::DiffuseAndGlossy,
            ior: 1.3,
            kd: 0.8,
            ks: 0.2,
            diffuse_color: v3f!(0.2),
            specular_exponent: 25.,
        }
    }
}

pub trait DrawableObj {
    fn intersect(
        &self,
        orig: Vector3f,
        dir: Vector3f,
        tnear: &mut f32,
        index: &mut u32,
        uv: &mut Vector2f,
    ) -> bool;
    fn get_surface_properties(
        &self,
        hit_point: Vector3f,
        dir: Vector3f,
        index: u32,
        uv: Vector2f,
        n: &mut Vector3f,
        st: &mut Vector2f,
    );

    fn eval_diffuse_color(&self, st: Vector2f) -> Vector3f;

    fn get_material_type(&self) -> MaterialType;
    fn get_ior(&self) -> f32;
    fn get_specular_exponent(&self) -> f32;
    fn get_kd(&self) -> f32;
    fn get_ks(&self) -> f32;
}
